package com.pai4j.common.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class JsonExtractorFromMarkdown {


    public static String getJson(String markdownText) {
        // 正则表达式用于匹配```json```标记的JSON代码块
        String regex = "```json\\s*\\n(.*?)\\n```";
        Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
        Matcher matcher = pattern.matcher(markdownText);
        if (matcher.find()) {
            return matcher.group(1).trim();
        }
        return null;
    }
}